package day04;

import java.util.Random;
import java.util.Scanner;

public class Guessing {
    public static void main(String[] args) {

        Random r = new Random();
        int num = r.nextInt(100)+1;

        Scanner sc = new Scanner(System.in);
        System.out.println("请输入你要猜的数字");

        int guessNum = sc.nextInt();

        while (guessNum != num) {
            if (guessNum > num) {
                System.out.println("你猜的数字过大,请重新输入");
            } else {
                System.out.println("你猜得数字过小，请重新输入");
            }
            guessNum=sc.nextInt();
        }
        System.out.println("恭喜你猜对了！");
    }
}
